package com.alpha.core.conf;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;

import com.alpha.task.service.CountDownService;

@Configuration
@ComponentScan(basePackages = { "com.alpha.task.* " })
public class SchedledConfiguration implements CommandLineRunner{

		protected Logger logger =  Logger.getLogger(getClass().getName());
		
		@Autowired
		private CountDownService countDownService;

		@Bean
		public SchedulerFactoryBean schedulerFactoryBean (){
			return new SchedulerFactoryBean();
		}

		
		
		@Override
		public void run(String... arg0) throws Exception {
			logger.info(" SchedledConfiguration  load trigger ");
			countDownService.toStartUnTriggerTask();
		}

}
